<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="common/taglib.jsp"%>
<!doctype html>
<html lang="zh">
	<head>
		<meta charset="UTF-8">
		<title>发布闲置（闲置房、闲置车、其他）</title>
		<link rel="stylesheet" href="${basePath}/style/css/base.css" />
		<link rel="stylesheet" href="${basePath}/style/css/main.css" />
		<script src="${basePath}/style/js/jquery.min.js"></script>
		<script src="${basePath}/style/js/main.js"></script>
		<link href="${basePath}/style/css/bootstrap.min.css" rel="stylesheet">
		<!-- 上传图片样式 -->
		<link href="${basePath}/style/css/default.css" rel="stylesheet">
		<script src="${basePath}/style/js/bootstrap.min.js" type="text/javascript"></script>
		
		
		 <link href="${basePath}/style/css/fileinput.css" media="all" rel="stylesheet" type="text/css" />	
		 <script src="${basePath}/style/js/fileinput.js" type="text/javascript"></script>
	</head>
	<body>
	<form id="goods" action="${basePath}/api/goods/saveGoods.do" method="post" enctype="multipart/form-data">
		<div id="header_div"></div>
		<div class="cont">
			<nav class="header_bottom">
				<a href="index.html" class="nav_item">首页</a>
				<a href="hot_sale.html" class="nav_item">今日热卖</a>
				<a href="todaysale.html" class="nav_item">特卖</a>
				<a href="idle_onsale .html" class="nav_item">我的二手</a>
				<a href="release_sechand.jsp" class="nav_item nav_on">发布二手</a>
			</nav>
			<div class="mt20">
				<ul class="personal_title_sec ml40">
					<a href="#" id="rel_1" onclick="release(1)"><li>二手房产</li></a>
					<a href="#" id="rel_2" class="grey" onclick="release(2)"><li>二手汽车</li></a>
					<a href="#" id="rel_3" class="grey" onclick="release(3)"><li>二手数码</li></a>
					<a href="#" id="rel_4" class="grey" onclick="release(4)"><li>奢侈品/化妆品</li></a>
					<a href="#" id="rel_5" class="grey" onclick="release(5)"><li>二手家居</li></a>
					<a href="#" id="rel_6" class="grey" onclick="release(6)"><li>服装/包</li></a>
					<a href="#" id="rel_7" class="grey" onclick="release(7)"><li>其它</li></a>
				</ul>
				<div class="ml40 mt50">
					<!--发布闲置-闲置房产-->
					<div class="">
						<div class="container kv-main">
						    <div class="form-group">
                               <input id="file-1" type="file" multiple class="file" data-overwrite-initial="false" data-min-file-count="3">
                            </div>
		                 </div>      
		                 </div>
						<div class="publish_info">
							<p class="mt20">所在地区:
				                <select id="province" class="common_inp" style="width:150px;margin-left:10px" onchange="getCity(this)">
				                	<option value="-1">请选择省</option>
				                </select>
				            </p>

							<p style="clear:both;">名称 <input type="text" class="common_inp mt10 ml40" id="title" name="title" ></p>
							<p>户型       <input type="text" class="common_inp mt10 ml40" id="dicHouseType" name="dicHouseType"></p>
							<p>售价       <input type="text" class="common_inp mt10 ml40" id="price" name="price"></p>
							<p>首付       <input type="text" class="common_inp mt10 ml40" id="primePrice" name="primePrice"></p>
							<p>单价       <input type="text" class="common_inp mt10 ml40" id="unitPrice" name="unitPrice"></p>
							<p>详细地址 <input type="text" class="common_inp mt10 ml40" id="address" name="address"style="margin-left: 8px;" ></p>
							<p>电话       <input type="text" class="common_inp mt10 ml40" id="telephone" name="telephone"></p>
							<p>QQ      <input type="text" class="common_inp mt10 ml40"  id="qq",name="qq"style="margin-left: 46px;" ></p>
							<p class="mt10">
								<label class="vt">宝贝介绍</label>
								<textarea id="description",name="description" class="text_intro"></textarea>
							</p>
							<div>
								<button class="btn_third btn_third_add f16 mt50" style=>发布</button>
							</div>
						</div>
					
				</div>
			</div>
		</div>

		<div id="footer_div"></div>
		<script type="text/javascript">
			$(function(){
				getAddress("");
				 $("#file-1").fileinput({
				        uploadUrl: '#', // you must set a valid URL here else you will get an error
				        allowedFileExtensions : ['jpg', 'png','gif'],
				        overwriteInitial: false,
				        maxFileSize: 1000,
				        maxFilesNum: 10,
				        //allowedFileTypes: ['image', 'video', 'flash'],
				        slugCallback: function(filename) {
				            return filename.replace('(', '_').replace(']', '_');
				        }
					});
			})
			
			//获取地址		
	function getAddress(id){
		$.ajax({
			type:"post",
			dataType:"text",
			url:"${basePath}/api/common/getAddress.do",
			data:{id:id},
			success:function (data) {
				var obj = eval("("+data+")");
				for(var a=0;a<obj.length;a++){
					$("#province")[0].options.add(new Option(obj[a].name,obj[a].dictionaries_id))
				}
			}
		});	
	}	
			//获取二级城市
			function getCity(){
				$('#province').nextAll().remove(); 
				var id=$("#province").val();
				$.ajax({
					type:"post",
					dataType:"text",
					url:"${basePath}/api/common/getAddress.do",
					data:{id:id},
					success:function (data) {
						var obj = eval("("+data+")");
						if(obj.length<1) return false;
						for(var a=0;a<obj.length;a++){
							$("#province").after('<select id="city" class="common_inp" style="width:150px;" onchange="getArea()"><option value="-1">请选择城市</option></select>');
							$("#city")[0].options.add(new Option(obj[a].name,obj[a].dictionaries_id))
						}
					}
				});	
			}
		function getArea(){
			var id=$("#city").val();
			$('#city').nextAll().remove(); 
			$.ajax({
				type:"post",
				dataType:"text",
				url:"${basePath}/api/common/getAddress.do",
				data:{id:id},
				success:function (data) {
					var obj = eval("("+data+")");
					if(obj.length<1) return false;
					for(var a=0;a<obj.length;a++){
						$("#city").after('<select id="area" class="common_inp" style="width:150px;" ><option value="-1">请选择区</option></select>');
						$("#area")[0].options.add(new Option(obj[a].name,obj[a].dictionaries_id))
					}
				}
			});
		}
		
			
			
		</script>
		</form>
	</body>
</html>
